You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The runtime implementation of generatePath already accepts numeric parameter values by converting them with String(...). However, the TypeScript definitions only allow string values, forcing developers to write unnecessary casts such as String(userId).
This creates a mismatch between the runtime behavior and the compile-time API.
Root Cause
GeneratePathParams and ParseParams restrict parameter values to string (or string | null | undefined for optional parameters), even though the runtime implementation already handles numeric values.
Solution
This PR updates the TypeScript definitions to allow:
string | number
string | number | null | undefined for optional parameters
This aligns the type definitions with the existing runtime behavior without changing runtime logic.
Tests
Added compile-time and runtime tests covering:
Required numeric parameters
Multiple numeric parameters
Optional numeric parameters
Mixed string/number parameters
Existing string behavior
Backward Compatibility
This change is fully backward compatible. Existing code using string parameters continues to compile unchanged because string remains assignable to the updated types.
This PR doesn't include a change file which is used for automated release notes.
If your change affects users, please add one (or more) change files and commit the generated file(s).
pnpm run changes:add
This script requires Node 24+. If you are on a lower version, please add a file manually
Not every PR needs a change file — you can skip this step if the change is internal-only
(tests, tooling, docs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The runtime implementation of
generatePathalready accepts numeric parameter values by converting them withString(...). However, the TypeScript definitions only allowstringvalues, forcing developers to write unnecessary casts such asString(userId).This creates a mismatch between the runtime behavior and the compile-time API.
Root Cause
GeneratePathParamsandParseParamsrestrict parameter values tostring(orstring | null | undefinedfor optional parameters), even though the runtime implementation already handles numeric values.Solution
This PR updates the TypeScript definitions to allow:
string | numberstring | number | null | undefinedfor optional parametersThis aligns the type definitions with the existing runtime behavior without changing runtime logic.
Tests
Added compile-time and runtime tests covering:
Backward Compatibility
This change is fully backward compatible. Existing code using string parameters continues to compile unchanged because
stringremains assignable to the updated types.